package array;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by fengliejv on 2022/1/9.
 */
public class SlowestKey1629 {
    public char slowestKey(int[] releaseTimes, String keysPressed) {
        char result = keysPressed.charAt(0);
        int max = releaseTimes[0];
        for (int i = 1; i < keysPressed.length(); i++) {
            char c = keysPressed.charAt(i);
            int time = releaseTimes[i] - releaseTimes[i - 1];
            if (time == max && c > result) {
                result = c;
            }
            if (time > max) {
                result = c;
                max = time;
            }
        }
        return result;
    }
}
